home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18076 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  35 lines

  1. Newsgroups: comp.lang.c++
  2. Path: newsfeed.internetmci.com!anasaz!duane
  3. From: duane@anasazi.com (Duane Morse)
  4. Subject: Re: Variable ARG list (of type double)?
  5. Message-ID: <Dq2H1G.371@anasazi.com>
  6. Sender: usenet@anasazi.com (News System)
  7. Organization: Anasazi Inc, Phoenix AZ USA
  8. References: <4l4552$al2@falcon.ccs.uwo.ca>
  9. Date: Thu, 18 Apr 1996 16:41:39 GMT
  10.  
  11. Sharon Wang <swang1@julian.uwo.ca> writes:
  12.  
  13. >I'd like to make a vector with given elements, e.g.
  14.  
  15. >    vector u(1,2,3), u(1,2,3,4,5);
  16.  
  17. >so I was trying to use va_start() and va_arg() in <stdarg.h>.
  18. >However, the manpage for stdarg.h and several C, C++ bibles give
  19. >only the examples in which, the argument list starts with
  20. >char *string, e.g. printf(const char *fmt, ...).  Anybody know
  21. >how to get (double arg, ...) work? (basically, how to terminate
  22. >the search for the last arg in the list)
  23.  
  24. >Sharon
  25. ><swang1@julian.uwo.ca>
  26.  
  27. You merely need to establish your own convention for marking the end of
  28. the list, implicitly or explicitly.  For instance, you could have the
  29. first parameter be the count of values which follow (explicit), or you
  30. can put a "sacred" value such as -1 at the end (implicit).
  31. -- 
  32.  
  33. Duane Morse    e-mail: duane@anasazi.com
  34. (602) 861-7609; Phoenix, Arizona
  35.